 |
|
 |
Subject: URLDownloadToFile() can't download the Website (it's a pdf-file) |
 |
 |
 |
Product Area: Notes Client |
 |
Technical Area: Application Development |
 |
Platform: Windows |
 |
Release: 8.5.2 |
 |
Reproducible: Always |
 |
 |
 |
 |
Hello
my lotus script code download the file from the internet only, if I opened it before in the internet explorer. But I have a lot of files to download monthly, so I would it automate.
I have the same code as Visual Basic Code in an Excel-file (as a macro). There I could download all files without opening before!
Bevor I start with downloading, I connect once "http://depatisnet.dpma.de/", to get a connection with it.
Question: How could I download the file in Lotus Notes without opening it before?
Here's my Lotus Script Code:
###############################################
Sub Click(Source As Button)
On Error Goto ErrHandler
Dim ses As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim Url As String
Dim Url2 As String
Dim Schriftnummer As String
Dim Dateiname As String
'Dim aLog As AgentLog
'Dim VerarbeiteteDokumente As String
Dim importdatei As String
Dim object As NotesEmbeddedObject
Set ses = New NotesSession
Set db = ses.CurrentDatabase
Set col = db.UnprocessedDocuments
Set view = db.getView("pdftext-Import")
Set doc = view.GetfirstDocument
Set w = New NotesUIWorkspace
'Set aLog = New AgentLog("TextPDF Import")
'VerarbeiteteDokumtente=""
Call w.URLOpen( "http://depatisnet.dpma.de/")
Do Until doc Is Nothing
'Download from Internet
Schriftnummer = Cstr(doc.CY_PN_KD(0))
'e.g. Hyperlink
'http://depatisnet.dpma.de/DepatisNet/depatisnet?action=textpdf&docid=DE03003827T1
Url2 = "http://depatisnet.dpma.de/DepatisNet/depatisnet?action=textpdf&docid=" & Schriftnummer
'e.g. Dateiname
'C:\textpdf\DE03003827T1_text.pdf
Dateiname = "C:\textpdf\"+Schriftnummer+"_text.pdf"
'Url = Inputbox$("URL eingeben",,Url2)
Url = Url2
' Download function
DownloadFile Url, Dateiname
Call DeleteUrlCacheEntry(Url)
' Get the next document
Set doc = view.getNextDocument( doc )
i% = i% + 1
all% = col.Count
Print "Bitte warten ... " + Cstr(i%) + " Dokument(e) insgesamt heruntergeladen"
Loop
Exit Sub
ErrHandler:
Resume Next
End Sub
###########################################
Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
#############################################
Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (Byval pCaller As Long, Byval szURL As String, _
Byval szFileName As String, Byval dwReserved As Long, Byval lpfnCB As Long) As Long
Declare Function DeleteUrlCacheEntry Lib "wininet" Alias "DeleteUrlCacheEntryA" (Byval lpszUrlName As String) As Long
############################################
Use "Common"
 
Feedback number WEBB8N3BU9 created by ~Mary Reveluvitchikle on 10/28/2011

Status: Closed
Comments: See Answer "Solution"

URLDownloadToFile() can't download ... (~Mary Reveluvit... 28.Oct.11)
. . Solution (~Mary Reveluvit... 24.Nov.11)
. . For me it works (~Maria Eltumima... 31.Oct.11)
. . . . Try it with my Hyperlinks (~Mary Reveluvit... 10.Nov.11) |
|  |
|